<template>
  <div class="live">
    <div class="cover">
      <img class="img100"
        :src="data.banner">
    </div>
    <div class="perons_num">
      <p class="lookNum">
        <strong>{{data.pageview}}</strong> 人正在收看此次图片查看
      </p>
      <p class="activityDetail-button"
        @click="isShowDetail = true">
        <span class="activityDetail-icon"></span>
        <span>活动详情</span>
      </p>
    </div>
    <transition name="slide-fade">
      <div class="activityDetail"
        @touchmove.stop.prevent
        @wheel.stop.prevent
        v-show="isShowDetail">
        <Icon type="ios-close"
          class="close"
          :size="40"
          @click="isShowDetail = false" />
        <div class="item">
          <p>活动时间</p>
          <p class="info">{{data.date}}</p>
        </div>
        <div class="item">
          <p>活动地点</p>
          <p class="info">{{data.address}}</p>
        </div>
        <div class="item">
          <p>活动简介</p>
          <p class="info">{{data.introduction}}</p>
        </div>
      </div>
    </transition>
    <div class="guest_title">
      <h2 class="ml10">{{data.title}}</h2>
      <div class="guest_pos">
        <p class="date">
          <i></i>
          {{data.date}}
        </p>
        <p class="addr">
          <i></i>
          {{data.address}}
        </p>
      </div>
    </div>
    <div class="guests">
      <div class="guest_wrap_item" v-for="(item,index) in sponsorArr" :key="index">
        <div class="guest-item__avator">
          <img class="img100"
            :src="item.logourl">
        </div>
        <p class="guest-item__name">{{item.name}}</p>
        <p class="guest-item__title">主办方</p>
      </div>
    </div>
    <div class="title_tab">
      <h2 class="photos_title" @click="isShowPhotos = true">图片直播</h2>
      <!-- <h2 class="photos_video" @click="isShowPhotos = false">视频直播</h2> -->
    </div>
    <photos v-if="isShowPhotos"></photos>
    <videos v-else></videos>
    <div class="qrcode">
      <p class="slogan">{{data.slogan}}</p>
      <img class="img100"
        :src="data.qrcodeurl">
    </div>
    <BackTop></BackTop>
  </div>
</template>

<script>
import Photos from '@/components/photos'
import Videos from '@/components/videos'
import { mapState } from 'vuex'

export default {
  name: 'live',
  components: {
    Photos,
    Videos
  },
  data() {
    return {
      isShowDetail: false,
      isShowPhotos: true
    }
  },
  computed: {
    ...mapState(['siteInfo']),
    data() {
      return this.siteInfo.data || {}
    },
    sponsorArr() {
      if (this.siteInfo.data && this.siteInfo.data.sponsor_arr) {
        try {
          return JSON.parse(this.siteInfo.data.sponsor_arr)
        } catch (error) {
          throw TypeError('xx is not a json string parse failed')
        }
      } else {
        return []
      }
    }
  },
  methods: {},
  mounted() {}
}
</script>

<style lang="scss" scoped>
.live {
  .cover {
    width: 100%;
  }
  .perons_num {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px 8px;
    border-bottom: 0.5px solid #373737;
    .lookNum {
      color: #6b6d70;
    }
    strong {
      color: #e53d00;
      font-size: 15px;
    }

    .activityDetail-button {
      font-size: 14px;
      display: flex;
      align-items: center;
    }
    .activityDetail-icon {
      display: inline-block;
      width: 13px;
      height: 13px;
      margin-right: 3px;
      background-image: url(http://static.qiezipai.cn/wechat/live/image/live4/activityDetail-icon.png);
      background-size: cover;
    }
  }
  .activityDetail {
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 11;
    padding: 50px 22px 22px;
    font-size: 16px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    .close {
      position: absolute;
      top: 20px;
      right: 20px;
    }
    .item {
      display: flex;
      margin-top: 20px;
    }
    p:first-child {
      width: 100px;
    }
    .info {
      flex: 1;
    }
  }
  .guest_title {
    margin: 22px 9px 0;
    background-color: #000;
    h2 {
      font-size: 19px;
      font-weight: 300;
      color: #e6e6e6;
      margin-left: 5px;
    }
    .guest_pos {
      opacity: 0.6;
      font-size: 15px;
      margin-top: 16px;
      .date i {
        background: url(https://herb.yicanfan123.com/mobile/template/static_img/images/date.png)
          no-repeat 0 center;
        background-size: 18px;
        width: 20px;
        height: 20px;
        display: inline-block;
        vertical-align: -5px;
      }
      .addr i {
        background: url(https://herb.yicanfan123.com/mobile/template/static_img/images/addr.png)
          no-repeat 0 center;
        background-size: 18px;
        width: 20px;
        height: 20px;
        display: inline-block;
        vertical-align: -5px;
      }
    }
  }
  .guests {
    display: flex;
    flex-flow: row wrap;
    background-color: #000;
    position: relative;
    z-index: 2000;
    .guest_wrap_item {
      width: 135px;
      margin-top: 10px;
      padding: 0 15px;
      display: flex;
      flex-direction: column;
      align-items: center;
      .guest-item__avator img {
        border-radius: 10px;
      }
      .guest-item__name {
        margin-top: 5px;
      }
      .guest-item__title {
        color: #9898a6;
      }
    }
  }
  .title_tab{
    display: inline-flex;
    justify-content: flex-start;
    align-items: center;
    padding: 0 14px;
    width: 100%;
    height: 60px;
    background-color: #000;
    position: relative;
    z-index: 2000;
    .photos_title{
      width: 100px;
    }
    .photos_video{
      width: 100px;
    }
  }
  .qrcode {
    padding: 22px;
    box-sizing: border-box;
    text-align: center;
    background-color: #000;
    .slogan {
      font-size: 22px;
      letter-spacing: 2px;
      margin-bottom: 20px;
      color: #d5d5d5;
      font-weight: 700;
    }
  }
}

.slide-fade-enter-active {
  transition: all 0.3s ease;
}
.slide-fade-leave-active {
  transition: all 0.4s cubic-bezier(1, 0.5, 0.8, 1);
}
.slide-fade-enter,
.slide-fade-leave-to {
  transform: translateX(10px);
  opacity: 0;
}
</style>
